package cz.muni.fi.cassandra.Firebrand.entities;

import org.firebrandocm.dao.annotations.Column;
import org.firebrandocm.dao.annotations.ColumnFamily;
import org.firebrandocm.dao.annotations.Key;
import org.firebrandocm.dao.annotations.Mapped;

@ColumnFamily
public class Tweet {

	@Key
	private String id;
	
	@Column(indexed = true)
	private String body;
	
	@Mapped()
	private User author;
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getBody() {
		return body;
	}
	public void setBody(String body) {
		this.body = body;
	}
	
	public User getAuthor() {
		return author;
	}
	public void setAuthor(User author) {
		this.author = author;
	}
	
	
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object object) {
		if (!(object instanceof Tweet)) {
			return false;
		}
		Tweet other = (Tweet) object;
		if ((this.id == null) || (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}
	@Override
	public String toString() {
		return "Tweet [id=" + id + ", body=" + body + ", author=" + author
				+ "]";
	}
	
	
	
	
}
